The directives described in this section all generate data (unless specified otherwise, the data goes into the current section). In some respects they are similar to the directives in the previous section, "Directives for Moving the Location Counter"--they do have the effect of moving the location counter--but this isn't their primary purpose.
.ascii [ "string "] [ ,"string "] ...
.asciz [ "string "] [ ,"string "] ...
These two directives translate character strings into their ASCII equivalents for use in the source program. Each directive takes zero or more comma-separated, quoted strings. Each string can contain any character or escape sequence that can appear in a character string; the newline character cannot appear, but it can be represented by the escape sequence \012 or \n .
If no strings are specified, the directive is ignored.
.ascii "Can't open the DSP.\0"
.asciz "%s has changes.\tSave them?"
.byte [ expression ] [ ,expression ] ...
.short [ expression ] [ ,expression ] ...
.long [ expression ] [ ,expression ] ...
These directives reserve storage locations in the current section and initialize them with specified values. Each directive takes zero or more comma-separated absolute expressions and generates a sequence of bytes for each expression. The expressions are truncated to the size generated by the directive:
.byte 74,0112,0x4A,0x4a,'J | all the same byte
.short 64206,0175316,0xface | all the same short
.long -1234,037777775456,0xfffffb2e | all the same long
.single [ number ] [ ,number ] ...
.double [ number ] [ ,number ] ...
These two directives reserve storage locations in the current section and initialize them with specified values. Each directive takes zero or more comma-separated decimal floating-point numbers:
.single 3.33333333333333310000e-01
.double 0.00000000000000000000e+00
.single +Infinity
.double -Infinity
.single NaN
.fill repeat_expression ,fill_size ,fill_expression
The .fill directive advances the location counter by repeat_expression times fill_size bytes.
.fill 69,4,0xfeadface | put out 69 0xfeadface's
.space num_bytes [ ,fill_expression ]
The .space directive advances the location counter by num_bytes , where num_bytes is an absolute expression greater than zero. The fill expression, if specified, must be absolute. The space between the current value of the location counter and the desired value is filled with the low-order byte of the fill expression (or with zeros, if fill_expression isn't specified).
ten_ones:
.space 10,1
.comm name ,size
The .comm directive creates a common symbol named name of size bytes. If the symbol isn't defined elsewhere, its type is "common."
The link editor allocates storage for common symbols that aren't otherwise defined. Enough space is left after the symbol to hold the maximum size (in bytes) seen for each symbol in the (__DATA,__common) section.
The link editor will align each such symbol (based on its size aligned to the next greater power of two) to the maximum alignment of the (__DATA,__common) section. For information about how to change the maximum alignment, see the description of -sectalign in the ld(1) Mac OS X manual page.
.comm _global_uninitialized,4
.lcomm name ,size [ ,align ]
The .lcomm directive creates a symbol named name of size bytes in the (__DATA,__bss) section. It will contain zeros at execution. The name isn't declared as global, and hence will be unknown outside the object module.
The optional align expression, if specified, causes the location counter to be rounded up to an align power-of-two boundary before assigning the location counter to the value of name .
.lcomm abyte,1 | or: .lcomm abyte,1,0
.lcomm padding,7
.lcomm adouble,8 | or: .lcomm adouble,8,3
.zerofill __DATA,__bss,abyte,1
.lcomm __DATA,__bss,padding,7
.lcomm __DATA,__bss,adouble,8